<template>
    <div class="container">
        <!-- 视频区域 -->
        <div class="video">
            <div
                class="video-ico"
                @click="videoClosure()"
            ><span class="el-icon-close"></span></div>
            <div class="video-box">
                <video
                    controls="controls"
                    id="video"
                    poster="@/assets/404_images/404.png"
                    autoplay
                    muted
                    :src="video.Url"
                ></video>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    name: 'Vedio',
    props: {
        video: {
            deep: true,
            type: Object,
            require: true
        },
    },
    data () {
        return {
            // 视频路径
            videoUrl: null,
        }
    },
    methods: {
        // 点击视频图标关闭
        videoClosure (row) {
            this.$emit('videoClosure',)
        },
    },
    // 侦听器-------------------------------------------------------
    watch: {
        video: {
            deep: true,
            immediate: true,
            handler (newVal, oldVal) {
                this.videoUrl = newVal.Url
            }
        }
    },
}
</script>

<style scoped lang='scss'>
.video {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    overflow: hidden;
    z-index: 99999;
    .video-ico {
        width: 50px;
        height: 50px;
        position: absolute;
        top: 30px;
        left: 50%;
        transform: translate(-50%, 0);
        background: rgba(0, 0, 0, 0.4);
        box-shadow: 0 0 5px rgba(0, 0, 0, 0.4);
        border-radius: 50%;
        text-align: center;
        line-height: 50px;
        color: #fff;
        font-size: 20px;
    }
    .video-box {
        width: 800px;
        height: 600px;
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        video {
            width: 100%;
            height: 100%;
        }
    }
}
</style>
